﻿@using System.Web.Optimization
@using Ed.Web.Helpers
@model Ed.Entity.TSysDepartment
@{
    //页面类型
    var actionType = ViewBag.ActionType;
    
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>雪绒花_部门信息管理_添加修改页面</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" conte="conte" nt="IE=Edge" />
    @Styles.Render("~/Themes/default/css/cp.globle.min1.css")
    @Scripts.Render("~/Themes/default/js/cp.globle.min1.js")
    <!--去除顶层加载中 14-10-17 By 唐有炜-->
    <script type="text/javascript">
        //=============================================================
        //去除顶层加载中
        $(document).ready(function () {
            //去除加载中
            if (undefined != top.dialog.list["show_loading"]) {
                top.dialog.list["show_loading"].close().remove();
                //showTopMsg("页面加载成功！", "温馨提示", "Success");
            }
        });
        //=====================================================================
    </script>
    <!--my97DatePicker-->
    <script src="/Themes/default/lib/my97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <!--省市数据-->
    <script src="/Themes/default/base/js/city.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            validate_form();
        });
            //表单验证
        function validate_form() {
            //表单验证
            $("#sysdepartment_form").validate({
                rules: {
            @if (@actionType == "Add")
            {
                //验证手机号是否存在
                        @Html.Raw("DepCode: {remote: { type: 'GET', url: '/api/SysDepartmentApi/Validate?fields=DepCode&eqs==&operations=AND&existReturn=false', data: { values: function () { return $('#DepCode').val()+'_s'; } } }}")
            }
        },
        messages: {
            DepCode: {
                    remote: "该部门编号已存在，请勿重复添加部门！"
                }  },
                 invalidHandler: function (e, validator) {
                        var msg = "有 " + validator.numberOfInvalids() + " 项填写有误，请检查！";
                        $("#msgprint").html(msg).show().focus();
                        setTimeout(function () {
                            $("#msgprint").fadeOut(500);
                            //如果动画结束则删除节点
                            if (!$("#msgprint").is(":animated")) {
                                $("#msgprint").hide();
                            }
                        }, 1000);
                    },
                    focusInvalid: false,
                    errorPlacement: function (error, element) {
                        var errorMsg = error[0].innerHTML;
                        var elementName = element[0].name;
                         $("#" + elementName).formtip(errorMsg);
                        $("#" + elementName).attr("placeholder", errorMsg);
                    },
                    success: function (element) {
                        var elem = $(element)[0].htmlFor;
                        $("#" + elem).poshytip('disable');
                        $("#" + elem).poshytip('destroy');
                        $("#" + elem).removeClass("error").addClass("success");
                    }
            });
        }
          //表单验证方法，供父窗口调用
        function form_valid() {
            if ($("#sysdepartment_form").valid()) {
                //        $('#formTab li:eq(1) a').tab("show");
                //        //修复验证bug
                //        $("#con_name").focus();
                //        if ($("#con_name").val() == "") {
                //            $("#con_name").formtip("主联系人不能为空！");
                //            return false;
                //        } else {
                //            return true;
                //  }
                return true;
            } else {
                return false;
            }
        }

    </script>
</head>
<body>
    <form id="sysdepartment_form" name="sysdepartment_form">
    <!--id-->
    @Html.HiddenFor(model => model.Id)
    <!--表单错误提示区-->
    <div tabindex="-1" id="msgprint" class="warning" style="position: fixed; width: 90%;
        display: none;">
        您的表单包含错误，请检查！</div>
    <div class="tab-content">
        <ul class="nav nav-tabs" id="formTab">
            <li class="active"><a href="#tab-info" data-toggle="tab">添加/修改查看部门信息</a></li>
        </ul>
        <div class="tab-pane active" id="tab-info">
            <div style="height: 15px;">
            </div>
            <table width="800" border="0" cellspacing="0" cellpadding="0" class="commontable shortSelect">
                <tbody>
                    <tr>
                        <th>
                            <span class="must">*</span>所属父部门：
                        </th>
                        <td>
                            @Html.DropDownListFor(model => model.ParentId, ViewData["listDepartment"] as SelectList, "请选择", new { @class = "form-control required", @style = "width: 200px; ", @placeholder = "" })
                        </td>
                        <th>
                            <span class="must">*</span>部门编号：
                        </th>
                        <td>
                            @Html.TextBoxFor(model => model.DepCode, new { @class = "form-control required", @style = "width: 200px; ", @placeholder = "部门编号" })
                        </td>
                    </tr>
                    <tr>
                        <th>
                            <span class="must">*</span>部门名称：
                        </th>
                        <td>
                            @Html.TextBoxFor(model => model.DepName, new { @class = "form-control required", @style = "width: 200px; ", @placeholder = "" })
                        </td>
                        <th>
                            <span class="must">*</span>部门排序：
                        </th>
                        <td>
                            @Html.TextBoxFor(model => model.DepOrder, new { @class = "form-control required number", @style = "width: 200px; ", @placeholder = "" })
                        </td>
                    </tr>
                    <tr>
                        <th>
                            部门描述：
                        </th>
                        <td colspan="3">
                            @Html.TextAreaFor(model => model.DepNote, new { @class = "form-control", @style = "width:600px;height:70px", @placeholder = "" })
                        </td>
                    </tr>
                    <tr>
                        <th>
                            创建日期：
                        </th>
                        <td colspan="3">
                            @Html.TextBoxFor(model => model.CreateDate, new { @class = "form-control Wdate required dateISO", Value = (Html.DateTimeNullPalse(Model.CreateDate)).ToString("yyyy-MM-dd"), onclick = "WdatePicker()", @minlength = "10", @maxlength = "10", @style = "width: 200px; ", @placeholder = "", @onfocus = "this.blur()" })
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    </form>
</body>
